﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using DAO;

namespace BUS
{
    public class NguoiDungBUS
    {
        public static bool ThemNguoiDung(NguoiDungDTO nd)
        {
            if (NguoiDungDAO.GetTheLoaiByMa(nd.MaNguoiDung) == null)
            {
                NguoiDungDAO.Insert(nd);
                return true;
            }
            else
            {
                return false;
            }
        }
        public static bool KiemTraNguoiDung(NguoiDungDTO nd)
        {
            if (NguoiDungDAO.KiemTraNguoiDung(nd) == true)
            {
                return true;
            }
            else
                return false;
        }
        public static bool XoaNguoiDung(NguoiDungDTO nd)
        {
            if (NguoiDungDAO.GetTheLoaiByMa(nd.MaNguoiDung) != null)
            {
                NguoiDungDAO.Delete(nd);
                return true;
            }
            else
            {
                return false;
            }
        }
        public static bool SuaNguoiDung(NguoiDungDTO nd)
        {
            if (NguoiDungDAO.GetTheLoaiByMa(nd.MaNguoiDung) != null)
            {
                NguoiDungDAO.Update(nd);
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
